
select ta.Name, cl.name
	from sys.tables ta join sys.columns cl
		on ta.object_id= cl.object_id
	where cl.column_id=1

declare @tabla nvarchar(100)
		,@columna nvarchar(100)
		,@qry nvarchar(max)
		,@cant nvarchar(10)
declare @temp table(tabla varchar(70),columna nvarchar(70),cantidad nvarchar(10))
declare qMaxId3 cursor for
	select quotename(ta.Name) 'tabla', quotename(cl.name) 'columna'
	from sys.tables ta join sys.columns cl
		on ta.object_id= cl.object_id
	where cl.column_id=1
open qMaxId3
FETCH NEXT FROM qMaxId3 INTO @tabla,@columna
While @@FETCH_STATUS = 0
begin
	set @qry =N'select @cantidad= max('+@columna+') from ' + @tabla
	exec sp_executesql @qry,N'@cantidad nvarchar(10) output',@cantidad=@cant output
	insert into @temp
		values(@tabla,@columna,@cant)
	
	FETCH NEXT FROM qMaxId3 INTO @tabla,@columna
END
select * from @temp
